//
// Created by zhouwd on 2019/8/1.
//

#ifndef IPTVSETTING_MEDIA_AUDIO_PLAY_H
#define IPTVSETTING_MEDIA_AUDIO_PLAY_H

#include <cstdlib>
#include "log_util.cpp"
#include <SLES/OpenSLES.h>
#include <media/NdkMediaExtractor.h>
#include <SLES/OpenSLES_Android.h>
#include <stdio.h>
#include "media_audio_decode.h"



typedef class _MEDIA_AUDIO_PLAY {
private:
    SLObjectItf engine_object;   //引擎对象
    SLEngineItf engine_engine;   //引擎接口
    //混音器
    SLObjectItf outputMixObject;
    SLEnvironmentalReverbItf outputMixEnvironmentalReverb = NULL;
    SLEnvironmentalReverbSettings reverbSettings = SL_I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR;

    //pcm
    SLObjectItf pcmPlayerObject = NULL;
    SLPlayItf pcmPlayerPlay = NULL;
    SLVolumeItf pcmPlayerVolume = NULL;

    //缓冲器队列接口
    SLAndroidSimpleBufferQueueItf pcmBufferQueue;


public:
    _MEDIA_AUDIO_PLAY();
    ~_MEDIA_AUDIO_PLAY();
    int init(const char *filename);
    int startAudioPlay();

    int stopAudioPlay();
} MediaAudioPlay;


#endif //IPTVSETTING_MEDIA_AUDIO_PLAY_H
